<%@ page language="java"  pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'test.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
		<LINK href="resource/css/admin.css" type="text/css" rel="stylesheet">
	<link rel="stylesheet" type="text/css" href="<%=basePath%>scripts/extjs/resources/css/ext-all.css" />   
	<script type="text/javascript" src="<%=basePath%>scripts/extjs/adapter/ext/ext-base.js"></script> 
	<script type="text/javascript" src="<%=basePath%>scripts/extjs/ext-all.js"></script>
	<script type="text/javascript">
	   Ext.onReady(function(){
	       Ext.QuickTips.init();//使得tips可用
	      var store=new Ext.data.Store({
	            autoLoad:true,
	           data:[{username:"鲁根成" ,password:"123456",sex:"男"},{username:"郭婷婷",password:"234567",sex:"女"}],
	           reader:new Ext.data.JsonReader({},Ext.data.Record.create([{name:'username',mapping:'username'},{name:'password',mapping:'password'},{name:'sex',mapping:'sex'}]))
	      });
	         var pageSize=2;
	          var pagingToolbar = new Ext.PagingToolbar({
             pageSize: pageSize,
            store: store,
            displayInfo: true,

        items:['-', '每页显示行数',
            new Ext.form.ComboBox({
                store:new Ext.data.SimpleStore({
                    fields: ['abbr', 'state'],
                    data : [[20,20],[25,25],[30,30],[35,35],[40,40],[45,45],[50,50]]
                }),
                width:50,
                displayField:'state',
                typeAhead: true,
                editable:false,
                mode: 'local',
                value:pageSize,
                triggerAction: 'all',
                selectOnFocus:true,
                listeners:{
                    change:{
                        fn:function(box, newValue, oldValue) {
                           changePageSize(newValue);
                        }
                    },
                    select:{
                        fn:function(combo, value) {
                            changePageSize(combo.getValue());
                        }
                    }
                }
            })
        ]
    });
	         var gridPanle=new Ext.grid.EditorGridPanel({
	              store:store,
	              baseCls:"x-plain",
	              enableColumnMove:false,
	              columns:[{header:"姓名",dataIndex:"username",sortable: true,
	                        editor:new Ext.form.TextField({
	                           allowBlank:false
	                        }),
	                        align:"center"
	                        
	                     },
	                   {header:"密码",dataIndex:"password", align:"center"},{header:"性别",dataIndex:"sex", align:"center"}
	              ],
	              frame:true,
	              width:400,
	              loadMask: {msg:'正在加载数据，请稍侯……'},
	              tbar:[{text:"添加人员"},"-",{text:"修改人员"}],
	               viewConfig: {
                    forceFit: true,
                    enableRowBody:false
                   },
	               renderTo:Ext.getBody(),
	               bbar:pagingToolbar
	         });
	       function changePageSize(pSize) {
        if (pSize != null && pSize > 0) {
            pageSize = parseInt(pSize);
            pagingToolbar.pageSize = pageSize;
            store.load({params:{start:0, limit:pageSize}});
            //gridStore.reload();
        }
    }
	      });
	</script>

  </head>
  
  <body>
     
  </body>
</html>
